package com.wpre.vampiremq.mqserver.core;

import lombok.Data;

import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * Description:消息的属性部分
 * User: LianBao
 * Date: 2025-01-11
 * Time: 21:14
 */

public class BasicProperties  implements Serializable {

    //消息的唯一身份标识(使用UUID)
    private String messageId;

    //与bindingKey对应
    //如果交换机类型是DIRECT,routingKey就表示要转发的队列名
    //如果交换机类型是FANOUT,routingKey则无意义
    //如果交换机类型是TOPIC,routingKey要和bindingKey做匹配,如果符号则转发
    private String routingKey;

    //这个属性表示消息是否要持久化,1表示不持久化,2表示持久化(参考的RabbitMQ)
    private int deliverMode = 1;


    public String getMessageId() {
        return messageId;
    }

    public void setMessageId(String messageId) {
        this.messageId = messageId;
    }

    public int getDeliverMode() {
        return deliverMode;
    }

    public void setDeliverMode(int deliverMode) {
        this.deliverMode = deliverMode;
    }

    public String getRoutingKey() {
        return routingKey;
    }

    public void setRoutingKey(String routingKey) {
        this.routingKey = routingKey;
    }

    @Override
    public String toString() {
        return "BasicProperties{" +
                "messageId='" + messageId + '\'' +
                ", routingKey='" + routingKey + '\'' +
                ", deliverMode=" + deliverMode +
                '}';
    }
}
